# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT([logpp], [0.16], [ristov at users d0t s0urcef0rge d0t net])
AC_CONFIG_SRCDIR([src/logpp.c])
AC_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE([1.9 foreign])

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL

# Checks for libraries.
AC_ARG_WITH([libpcre],
  [AS_HELP_STRING([--with-libpcre],
    [support for Perl-compatible regular expressions])],
  [],
  [with_libpcre=check])

AS_IF([test "x$with_libpcre" != xno],
  [AC_CHECK_LIB([pcre], [pcre_compile], [],
                [if test "x$with_libpcre" != xcheck; then
                   AC_MSG_FAILURE(
                     [--with-libpcre was given, but test for libpcre failed])
                 fi
                ]) ])

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([errno.h fcntl.h memory.h pcre.h regex.h signal.h stdlib.h string.h strings.h sys/select.h sys/stat.h sys/time.h sys/types.h syslog.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T

# Checks for library functions.
AC_CHECK_FUNCS([strcasecmp strncasecmp vsyslog])

# Set macros for compiling in large file support
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"

AC_CONFIG_FILES([Makefile man/Makefile src/Makefile])

AC_OUTPUT
